package com.qcs.sleep.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.qcs.sleep.log.Log4J;
import com.qcs.sleep.service.SleepListenerServicer;

/**
 * Created by chshqiang on 13-10-2.
 * 用于启动服务的广播监听器
 */
public class PowerOnBroadcast extends BroadcastReceiver {
    public static final String KEY = "action";

    @Override
    public void onReceive(Context context, Intent intent) {
        if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())
                || "android.intent.action.USER_PRESENT".equals(intent.getAction())) {
            Intent t = new Intent();
            t.setClass(context, SleepListenerServicer.class);
            t.putExtra(KEY, intent.getAction());

            context.startService(t);
        }
    }
}
